Bokeh Tutorial

1.4 Plotting - Climate

Exercise: Plot temperature anomaly monthly average for a given year and month by lat/lon with bokeh.plotting.image_rgba()

  • Data: 'data/Land_and_Ocean_LatLong1.nc'

Note: For your convienience, I'm providing an RGBAColorMapper


In [ ]:
from utils.colormap import RGBAColorMapper

In [ ]:
# Get the netCDF4 variable for temperature anomaly

In [ ]:
# Initialize the colormap with a bokeh palette and the low and high values for the scale.

In [ ]:
# Write a function ``get_slice(temperature_variable, year, month)`` that given a temperature variable, year and month
# returns an array of rgba colors. (Hint: Use RGBAColorMapper.color()).

In [ ]:
from bokeh.plotting import figure, output_notebook, show

In [ ]:
# Set output option

In [ ]:
# Get image data for a given year and month using the ``get_slice`` function

In [ ]:
# Create plot
# Tip: Make sure to set x_range and y_range appropriately

In [ ]:
# Show plot

In [ ]:
# Change the year and month and rerun the plot again.

Exercise: Overlay the worldmap boundaries in the temperature image plot


In [ ]:
# Get the worldmap data

In [ ]:
# Create your plot

In [ ]:
# Show plot